package com.wdhcr.utils;

import com.wdhcr.enums.ResultCode;
import org.springframework.stereotype.Component;

/*
 * @description: 封装统一返回的包装类
 * @author: wdhcr
 * @dateTime: 2020/3/9 13:47
 */
@Component
public class ResponseResult {

    //状态码
    private int code;
    //消息
    private String message;
    //额外的内容
    private Object data;

    public ResponseResult() {
        this.code = ResultCode.FAIL.getCode();
        this.message = "请求失败";
        this.data = null;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }


    public ResponseResult(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
}
